package com.label.common;

import lombok.Getter;

@Getter
public class CommonResult {
    private Integer code;
    private String message;
    private Object data;
    private CommonResult(Integer code, String message,Object obj){
        this.code=code;
        this.message=message;
        this.data=obj;
    }
    public static CommonResult nohandler(){
        return new CommonResult(ResultCode.NOHANDLER.getCode(),ResultCode.NOHANDLER.getMessage(),null);
    }
    public static CommonResult success(Object data){
        return new CommonResult(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(),data);
    }
    public static CommonResult failed(){
        return new CommonResult(ResultCode.FAILDE.getCode(), ResultCode.FAILDE.getMessage(), null);
    }
    public static CommonResult failed(String message){
        return new CommonResult(ResultCode.FAILDE.getCode(), message,null);
    }
    public static CommonResult loginfailed(){
        return new CommonResult(ResultCode.LOGINFAIDE.getCode(), ResultCode.LOGINFAIDE.getMessage(),null);
    }
    public static CommonResult token(Object data){
        return new CommonResult(ResultCode.TOKEN.getCode(),ResultCode.TOKEN.getMessage(),data);
    }
    public static CommonResult notoken(Object data){
        return new CommonResult(ResultCode.NOTOKEN.getCode(), ResultCode.NOTOKEN.getMessage(), data);
    }
    public static CommonResult nopremiss(){
        return new CommonResult(ResultCode.NOPERMISS.getCode(), ResultCode.NOPERMISS.getMessage(), null);
    }
}
